/*************************************************
 * HISTORY:                                      *
 *	06/22/2020 pyx : Created.                    *
 *	03/04/2021 pyx : Edited.                     *
=================================================*/

#ifndef DATRANSFORMER_FILEMANAGER_H
#define DATRANSFORMER_FILEMANAGER_H

#include <string>
#include <iostream>
#include <fstream>
#include <assert.h>
#include <unordered_map>
#include <unistd.h>
#include <vector>
#include <set>
#include <map>

#include "DATransformerUtil.h"
#include "DATransformerConnector.h"

class FileManager
{
public:
	struct File
	{ //Unused!
		unsigned fid;
		std::string filepath;
	};

	FileManager(std::string workspace);
	~FileManager();

	unsigned addFile(std::string filepath);//private

	unsigned getFID(std::string filepath);


	unsigned getFID_not_add(std::string filepath);
	
	std::string getFilePath(unsigned fid);
	void finilize();

private:
	std::string directory; //distinguish project/extern

	std::set<std::string> filePathSet;

	std::vector<std::string> filePathTable;				   //fid = index+1;
	std::unordered_map<std::string, unsigned> fileIDTable; //id from 1
};

#endif //DADATRANSFORMER_FILEMANAGER_H
